<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php $this->load->view(TPL_FOLDER."header");?>
<script type="text/javascript" src="{root_path}js/jquery/jquery.colorPicker-1.0.1.js"></script>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" >
  <tr>
    <td width="3%" align="left" ><img src="{tpl_path}images/forward.jpg" /></td>
    <td width="97%" align="left" >您现在的位置：<a href="<?php echo site_url(CTL_FOLDER."site_config");?>">网站信息配置</a></td>
  </tr>
</table>
<div id="TabAdd" style="display:none">
    <ul>
      <li><a href="#TabAdd-1"><span>基本信息</span></a></li>
      <li><a href="#TabAdd-2"><span>联系信息</span></a></li>
      <li><a href="#TabAdd-3"><span>图片处理</span></a></li>
      <li><a href="#TabAdd-4"><span>其他设置</span></a></li>
    </ul>
    <form action="<?php echo site_url(CTL_FOLDER."site_config/save_record");?>" method="post" enctype="multipart/form-data" name="dialog_edit_form" id="dialog_edit_form">
    <div id="TabAdd-1">
        <table width="100%"  border="0" cellpadding="3" cellspacing="0" >
           <tr>
            <td width="133"><font color="#FF0000">*</font>网站名称：</td>
            <td width="592" ><input Name="sys_site_name" type="text" size="60" maxlength="250" value="<?php echo $edit_data['sys_site_name'];?>" dataType="Require" msg="该项必须填写" title="简明扼要就行"></td>
          </tr>
           <tr>
            <td width="133"><font color="#FF0000">*</font>网站标题：</td>
            <td width="592" ><input Name="sys_site_title" type="text" size="60" maxlength="250" value="<?php echo $edit_data['sys_site_title'];?>" dataType="Require" msg="该项必须填写" title="该标题将显示在浏览器的标题栏上"></td>
          </tr>
          <tr>
            <td>上传LOGO：</td>
            <td>
            <img src="{tpl_path}images/loading.gif" rel="{root_path}<?php echo $edit_data['sys_site_logo'];?>" border="0" class="jq_pic_loading" />
            <br /><input type="text" value="<?php echo $edit_data['sys_site_logo'];?>" name="pic_path1" id="pic_path1" size="25" />  <input name="sys_site_logo" type="file" id="sys_site_logo" size="15" dataType="Filter" accept="<?php echo str_replace("|",",",UP_IMAGES_EXT);?>" require="false" msg="文件格式必须是：<?php echo UP_IMAGES_EXT;?>" title="上传的文件格式必须是：<?php echo UP_IMAGES_EXT;?>,且单个文件不能超过 <?php echo ini_get("upload_max_filesize");?>"> <input type="button" name="sfbtn" class="button-style2" onclick="GetFileDialog('pic_path1')" value="选择文件" />
            </td>
          </tr>
          <tr>
            <td width="133"><font color="#FF0000">*</font> Meta 关键字：</td>
            <td width="592"><input type="text" value="<?php echo $edit_data['sys_site_keyword'];?>" size="60" maxlength="250" dataType="Require" msg="该项必须填写" name="sys_site_keyword" title="关键字之间使用半角逗号（,）分隔，不超过250个字符"></td>
          </tr>
          <tr>
            <td><font color="#FF0000">*</font> Meta 描述：</td>
            <td><textarea name="sys_site_description" class="tooltips" cols="60" rows="5" dataType="Limit" max="500" msg="字数不超过500" title="字符数不超过500"><?php echo $edit_data['sys_site_description'] ;?></textarea></td>
          </tr>
          <tr>
            <td width="133"><font color="#FF0000">*</font> 网站版权：</td>
            <td width="592"><input type="text" value="<?php echo $edit_data['sys_site_copyright'];?>" size="60" maxlength="250" dataType="Require" msg="该项必须填写" name="sys_site_copyright" title="例如：© 2003-2010 天夏网络 保留所有权利"></td>
          </tr>
          <tr>
            <td width="133"><font color="#FF0000">*</font> 网页缓存周期：</td>
            <td width="592">
            <input type="text" name="sys_cache_time" id="sys_cache_time" maxlength="10" size="5" value="<?php echo $edit_data['sys_cache_time'];?>" title="例如填写：10 表示每10分钟更新一次缓存，如果不缓存页面，请填写0" dataType="Integer" msg="必须填写数字" /> <input type="button" class="button-style" onclick="clear_cache()" value="清除缓存" /></td>
          </tr>
          <tr>
            <td width="133"><font color="#FF0000">*</font> 浮动客服：</td>
            <td width="592"><input type="radio" value="1"  name="sys_is_open_im" <?php if ($edit_data['sys_is_open_im'] === '1') echo 'checked';?> /> 开启 &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" value="0" name="sys_is_open_im" <?php if ($edit_data['sys_is_open_im'] === '0') echo 'checked';?> /> 关闭</td>
          </tr>
        </table>
      </div>
      <div id="TabAdd-2">
      	<table width="100%"  border="0" cellpadding="3" cellspacing="0" >
           <tr>
            <td width="133"><font color="#FF0000">*</font>公司名称：</td>
            <td width="592" ><input Name="sys_corp" type="text" size="60" maxlength="250" value="<?php echo $edit_data['sys_corp'];?>" dataType="Require" msg="该项必须填写"></td>
          </tr>
           <tr>
            <td width="133">公司地址：</td>
            <td width="592" ><input Name="sys_address" type="text" size="60" maxlength="250" value="<?php echo $edit_data['sys_address'];?>"></td>
          </tr>
           <tr>
            <td width="133">手机号码：</td>
            <td width="592" ><input Name="sys_mobile" type="text" size="60" maxlength="250" value="<?php echo $edit_data['sys_mobile'];?>" title="多个号码之间使用竖线“|”隔开"></td>
          </tr>
           <tr>
            <td width="133">公司电话：</td>
            <td width="592" ><input Name="sys_tel" type="text" size="60" maxlength="250" value="<?php echo $edit_data['sys_tel'];?>" title="多个号码之间使用竖线“|”隔开"></td>
          </tr>
           <tr>
            <td width="133">公司传真：</td>
            <td width="592" ><input Name="sys_fax" type="text" size="60" maxlength="250" value="<?php echo $edit_data['sys_fax'];?>" title="多个号码之间使用竖线“|”隔开"></td>
          </tr>
           <tr>
            <td width="133">E-mail：</td>
            <td width="592" ><input Name="sys_email" type="text" size="60" maxlength="250" value="<?php echo $edit_data['sys_email'];?>" title="多个号码之间使用竖线“|”隔开"></td>
          </tr>
        </table>
      </div>
      <div id="TabAdd-3">
      <table width="100%"  border="0" cellpadding="3" cellspacing="0" >
           <tr>
            <td width="133"><font color="#FF0000">*</font>缩略图大小(像素)：</td>
            <td width="592" >宽 <input Name="thumb_width" type="text" size="5" maxlength="5" value="<?php echo $edit_data['thumb_width'];?>" dataType="Integer" msg="宽度值必须为大于0的数字"> x 高 <input Name="thumb_height" type="text" size="5" maxlength="5" value="<?php echo $edit_data['thumb_height'];?>" dataType="Integer" msg="高度值必须是大于0的数"></td>
          </tr>
           <tr>
            <td width="133"><font color="#FF0000">*</font>水印类型：</td>
            <td width="592" ><input type="radio" name="wm_type" id="wm_type" value="overlay" <?php if($edit_data['wm_type']=="overlay") echo "checked";?> title="支持透明的png图片" /> 图片水印 &nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="wm_type" id="wm_type" value="text" <?php if($edit_data['wm_type']=="text") echo "checked";?> /> 文字水印  </td>
          </tr>
          <tr>
            <td width="133">上传水印图片：</td>
            <td width="592"><img src="{tpl_path}images/loading.gif" rel="{root_path}<?php echo $edit_data['wm_overlay_path'];?>" border="0" class="jq_pic_loading" /><br />
           <input type="text" value="<?php echo $edit_data['sys_site_logo'];?>" name="pic_path2" id="pic_path2" size="25" /> <input name="wm_overlay_path" type="file" id="wm_overlay_path" size="15" dataType="Filter" accept="<?php echo str_replace("|",",",UP_IMAGES_EXT);?>" require="false" msg="文件格式必须是：<?php echo UP_IMAGES_EXT;?>" title="支持透明的png图片,上传的文件格式必须是：<?php echo UP_IMAGES_EXT;?>,且单个文件不能超过 <?php echo ini_get("upload_max_filesize");?>">  <input type="button" name="sfbtn" class="button-style2" onclick="GetFileDialog('pic_path2')" value="选择文件" /></td>
          </tr>
          <tr>
            <td width="133">水印文字：</td>
            <td width="592" ><input Name="wm_text" id="wm_text" type="text" size="60" maxlength="250" value="<?php echo $edit_data['wm_text'];?>"> <input type="hidden" name="wm_font_color" id="wm_font_color" value="<?php echo $edit_data['wm_font_color'];?>" /><img style="cursor:pointer; background-color:<?php echo $edit_data['wm_font_color'];?>" src="{tpl_path}images/color.gif"  align="absmiddle" onclick="$(this).colorPicker({ setValue:'input[name=wm_font_color]' ,setBackground:true })" title="水印文字的颜色" /></td>
          </tr>
           <tr>
            <td width="133">字体大小：</td>
            <td width="592" ><select name="wm_font_size" class="tooltips" title="该项设置对添加文字水印时有效">
           <?php foreach($font_size as $value) 
		   {
		   ?>
           <option value="<?php echo $value;?>" <?php if($edit_data['wm_font_size']==$value) echo "selected";?>><?php echo $value;?></option>
           <?php
		   }
		   ?>
          </select></td>
          </tr>
          <tr>
            <td width="133">水印位置：</td>
            <td width="592" ><select name="wm_hor_vrt" class="tooltips" title="该项设置对文字水印和图片水印都有效">
           <option value="left|top" <?php if($edit_data['wm_hor_alignment']."|".$edit_data['wm_vrt_alignment']=="left|top") echo "selected";?>>左上</option>
           <option value="left|middle" <?php if($edit_data['wm_hor_alignment']."|".$edit_data['wm_vrt_alignment']=="left|middle") echo "selected";?>>左中</option>
           <option value="left|bottom" <?php if($edit_data['wm_hor_alignment']."|".$edit_data['wm_vrt_alignment']=="left|bottom") echo "selected";?>>左下</option>
           <option value="center|top" <?php if($edit_data['wm_hor_alignment']."|".$edit_data['wm_vrt_alignment']=="center|top") echo "selected";?>>中上</option>
           <option value="center|middle" <?php if($edit_data['wm_hor_alignment']."|".$edit_data['wm_vrt_alignment']=="center|middle") echo "selected";?>>中间</option>
           <option value="center|bottom" <?php if($edit_data['wm_hor_alignment']."|".$edit_data['wm_vrt_alignment']=="center|bottom") echo "selected";?>>中下</option>
           <option value="right|top" <?php if($edit_data['wm_hor_alignment']."|".$edit_data['wm_vrt_alignment']=="right|top") echo "selected";?>>右上</option>
           <option value="right|middle" <?php if($edit_data['wm_hor_alignment']."|".$edit_data['wm_vrt_alignment']=="right|middle") echo "selected";?>>右中</option>
           <option value="right|bottom" <?php if($edit_data['wm_hor_alignment']."|".$edit_data['wm_vrt_alignment']=="right|bottom") echo "selected";?>>右下</option>
          </select></td>
          </tr>
        </table>
      </div>
      <div id="TabAdd-4">
      	<table width="100%"  border="0" cellpadding="3" cellspacing="0" >
           <tr>
            <td width="229">SMTP 服务器地址：</td>
            <td width="742" ><input Name="smtp_host" type="text" size="20" maxlength="250" value="<?php echo $edit_data['smtp_host'];?>" dataType="Require" msg="该项必须填写" title="常用SMTP：smtp.163.com | smtp.126.com | smtp.sohu.com | smtp.qq.com"></td>
          </tr>
           <tr>
            <td width="229">SMTP 用户账号：</td>
            <td width="742" ><input Name="smtp_user" type="text" size="20" maxlength="250" value="<?php echo $edit_data['smtp_user'];?>" dataType="Require" msg="该项必须填写" title="发信邮箱的登陆账号"></td>
          </tr>
           <tr>
            <td width="229">SMTP 密码：</td>
            <td width="742" ><input Name="smtp_pass" type="password" size="20" maxlength="250" value="<?php echo $edit_data['smtp_pass'];?>" dataType="Require" msg="该项必须填写" title="发信邮箱的登陆密码"></td>
          </tr>
          <tr>
            <td width="229">SMTP 发信邮箱：</td>
            <td width="742" ><input Name="smtp_email" type="text" size="30" maxlength="250" value="<?php echo $edit_data['smtp_email'];?>" dataType="Email" msg="邮箱格式有误" title="发信的电子邮箱"></td>
          </tr>
          <tr>
            <td width="229">通知邮箱：</td>
            <td width="742" ><input Name="smtp_re_email" type="text" size="30" maxlength="250" value="<?php echo $edit_data['smtp_re_email'];?>" dataType="Email" msg="邮箱格式有误" title="比方客户下单，用于接收通知的邮箱"></td>
          </tr>
        </table>
      </div>
      <input type="button" name="sbmit" style=" margin-left:160px; margin-bottom:10px; margin-top:10px" onClick="sub_edit_form()" value="修改" class="button-style2" />
    </form>
  </div>
<script language="javascript">
$(document).ready(function(){
	$("#TabAdd").tabs();
	$("#TabAdd").show();
}); 
function clear_cache() 
{
	if(confirm("确定要清除网页缓存?"))
	{
		hiOverAlert("<span id='showMsg' style='font-size:12px;'><img src='"+pic_loading_path+"' border='0' /> 数据提交中，请稍等...</span>",0);
		$.ajax({
			type: "POST",
			url: "<?php echo site_url(CTL_FOLDER."main/clear_cache"); ?>",
			data:   "rd_id=ttt",
			success: function(msg){ 
				if(msg==1) {
					$("#showMsg").html("缓存清除成功...");
					setTimeout(function(){unhiOverAlert();},2000);
				} else {
					$("#showMsg").html("缓存清除失败...");
					setTimeout(function(){unhiOverAlert();},2000);
				}
			},
			error: function(data){ 
				$("#showMsg").html("缓存清除失败...");
				setTimeout(function(){unhiOverAlert();},2000);
			}
		}); 
	}
}
function sub_edit_form(){
	var form_ob=document.getElementById("dialog_edit_form"); 
	if (!Validator.Validate(form_ob,3)) return false;
	if($("#wm_type checked").val()=="text"&&$("#wm_text").val()=='')
	{
		alert("您选择了添加文字水印，请填写水印文字");
		$("#wm_text").focus();
		return false;
	}
	form_ob.submit();
}
</script>
<?php $this->load->view(TPL_FOLDER."footer");?>